module Main where
import IO
import Char


--data CellValue = Empty | String | Number | Average | Product
--data CellType = Cell Empty | Cell Number | Cell String  deriving (Read, Show, Eq)
--		| CellFloat Char Int Float deriving (Read, Show, Eq)

data CellType = CellString Char Int String
		| CellFloat Char Int Float deriving (Read, Show, Eq)


--showCellType (CellString x y formula) = formula

--type Row = [CellType]
--type CellTable = [[CellType]]


--Tworzenie nowego wiersza i tabeli
newRow _ 0 = [] 
newRow value row = value : (newRow value (row-1) )

newTable _ 0 _ = []
newTable value rowsSize colsSize = ( newRow value colsSize ) : ( newTable value (rowsSize - 1) colsSize )

--Ustawianie zadanej wartosci wiersza i tabeli
setRowValue (x:xs) value 0   = value : xs
setRowValue (x:xs) value col = x : setRowValue xs value (col - 1) 

setTableValue (x:xs) value 0 col   =  (setRowValue x value col) : xs
setTableValue (x:xs) value row col =  x : (setTableValue xs value (row - 1) col)

--Dodawanie, usuwanie elementow wiersza
insertIntoRow (x:xs) value 0   = value : (x:xs)
insertIntoRow (x:xs) value col = x : setRowValue (x:xs) value (col - 1) 

removeFromRow 0 (_:xs) = xs 
removeFromRow col (x:xs) = x : (removeFromRow (col - 1) xs)

--Dodawanie usuwanie elementow tabeli
removeColumnFromTable col [] = []
removeColumnFromTable col (x:xs) = (removeFromRow col x) : (removeColumnFromTable col xs)


--initSpreadSheet rowsSize colsSize = newTable Empty rowsSize colsSize 

 
--showCellList :: CellList -> String
--showCellList [] = "|"
--showCellList ((CellString x y formula):xs) = "|" ++ formula ++ showCellList xs
	

--otrzymywanie kolejnych wartości
--do poprawy po zmianie konstruktorów
--cell_fst :: CellType a -> Char
--cell_fst (Cell x _ _) = x

--cell_snd :: CellType a -> Int
--cell_snd (Cell _ y _) = y

--cell_trd :: CellType a -> a
--cell_trd (Cell _ _ z) = z


--cellToStr Cell a = 

komendy = do 	putStrLn "Powiedz co chcesz zrobic:"
		putStrLn "1. Utworzyc nowy plik"
		putStrLn "2. Wczytac plik plik"
		putStrLn "3. Pracowac na otwartym pliku"
		putStrLn "\n Numer komendy:"

zadanie a	| a == 1 = putStrLn ("a wybrales " ++ [intToDigit(a)])
		| a == 2 = putStrLn ("b wybrales " ++ [intToDigit(a)])
		| a == 3 = putStrLn ("c wybrales " ++ [intToDigit(a)])

main = 
	do 	komendy
		komenda <- getLine
		zadanie(digitToInt(head(komenda)))



